import {userUserStore} from "@/stores/index.js";
import {getStuInfo} from "@/api/stu.js";
import {message} from 'ant-design-vue'
import {getCompanyList} from "@/api/company.js";
import {allCompanyStore} from "@/stores/modules/allCompanyAndJobs.js";

export const setStuInfo = async ()=>{
    const resGet = await getStuInfo()
    if(resGet.data.code ===200){
        userUserStore().setUserInfo(resGet.data.data)
    }else {
        message.error(resGet.data.message)
    }
    return resGet.data.code
}

//获取所有的公司
export const getAllCompany = async ()=>{
    const res = await getCompanyList()
    if(res.data.code ===200){
        const allCompany = res.data.data.map(company => ({
            label: company.companyName,
            value: company.companyName
        }));
        allCompanyStore().setAllCompany(allCompany)
    }else {
        message.error('获取公司信息失败')
    }
}
